package patrol.mobile.com.mobilepatrol.activity.security;

import android.support.annotation.NonNull;
import android.view.View;

import java.util.List;

import patrol.mobile.com.mobilepatrol.R;
import patrol.mobile.com.mobilepatrol.activity.CommonHomeActivity;
import patrol.mobile.com.mobilepatrol.activity.office.HomeDataHelper;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.AvoidActivity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyCheck1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyCuring1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyDrill1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyEnsure1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyEnsureMadeActivity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyEvent1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyFestivalDutyActivity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyOutSaveManager1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyPlan1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyProtectActivity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyProtectCollectionActivity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencyProtectListActivity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencySaveAgency1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencySaveCheckLeader1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencySaveCollectionActivity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencySaveEdu1Activity;
import patrol.mobile.com.mobilepatrol.activity.security.emergency.EmergencySaveZG1Activity;
import patrol.mobile.com.mobilepatrol.adapter.MyHomeAdapter;
import patrol.mobile.com.mobilepatrol.bean.HomeDataBean;

/**
 * Created by K on 2018/9/12.
 * des: 安保管理主页1
 */
public class SecurityManagerHomeActivity extends CommonHomeActivity {
//    private static final String[] stringsTop = new String[]{"应急管理", "安全生产", "综治维稳和平安建设", "包联包户"};
//    private static final String[] stringsSub1 = new String[]{"应急保障基地", "应急机制", "应急预案体系", "应急演练", "应急事件统计"};//"应急检查","安全考核汇总","应急保障机制"
//    private static final String[] stringsSub2 = new String[]{"安全生产机构", "安全教育", "作业区专项检查", "外包工程安全管理", "安全检查"};//"安全事故处理", , "定期检查",
//    //    private static final String[] stringsSub3 = new String[]{"护队花名册", "维稳器材汇总", "节日值班表", "值带班检查", "综治维稳定期检查", "包联包户","防爆汇总1","防爆汇总2","包联领导","包联编辑1"};
//    private static final String[] stringsSub3 = new String[]{"护队花名册", "维稳器材汇总", "节日值班表", "值带班检查"};//"综治维稳检查",
//    private static final String[] stringsSub4 = new String[]{"包联包户"};//"综治维稳检查",
//    //private static final int[] img1 = new int[]{R.mipmap.emergency_base, R.mipmap.emergency_mechanism, R.mipmap.ntingency_plan, R.mipmap.emergency_rehearsal, R.mipmap.security_check, R.mipmap.emergency_statistics, R.mipmap.assess_pool, R.mipmap.assess_pool};
//    private static final int[] img1 = new int[]{R.mipmap.emergency_base, R.mipmap.emergency_mechanism, R.mipmap.ntingency_plan, R.mipmap.emergency_rehearsal, R.mipmap.security_check};
//    // private static final int[] img2 = new int[]{R.mipmap.organization, R.mipmap.safety_education, R.mipmap.accident_treatment, R.mipmap.accident_treatment, R.mipmap.chance_inspect, R.mipmap.periodic_inspection, R.mipmap.ectocy_administration};
//    private static final int[] img2 = new int[]{R.mipmap.organization, R.mipmap.safety_education, R.mipmap.accident_treatment, R.mipmap.accident_treatment, R.mipmap.chance_inspect};
//    //    private static final int[] img3 = new int[]{R.mipmap.roster, R.mipmap.equipment_summary, R.mipmap.holiday_rota, R.mipmap.check_duty, R.mipmap.comprehensive_examination, R.mipmap.packs, R.mipmap.comprehensive_examination, R.mipmap.ntingency_plan, R.mipmap.emergency_statistics, R.mipmap.chance_inspect};
//    //private static final int[] img3 = new int[]{R.mipmap.roster, R.mipmap.equipment_summary, R.mipmap.holiday_rota, R.mipmap.check_duty, R.mipmap.comprehensive_examination, R.mipmap.packs};
//    private static final int[] img3 = new int[]{R.mipmap.roster, R.mipmap.equipment_summary, R.mipmap.holiday_rota, R.mipmap.check_duty, R.mipmap.comprehensive_examination};
//    private static final int[] img4 = new int[]{R.mipmap.comprehensive_examination};
//    /**
//     * ----------------------------------------------------------------------------------
//     **/
//
//    private static final String[] stringsTopYW = new String[]{"目标管理考核", "安全生产", "综治维稳", "包联包户"};
//    private static final String[] stringsSub1YW = new String[]{"综合检查"};
//    private static final String[] stringsSub2YW = new String[]{"作业区专项检查", "安全检查", "安全整改"};
//    private static final String[] stringsSub3YW = new String[]{"值带班检查"};
//    private static final String[] stringsSub4YW = new String[]{"包联包户"};
//    private static final String[] stringsSub5YW = new String[]{"包联包户"};
//    //private static final int[] img1 = new int[]{R.mipmap.emergency_base, R.mipmap.emergency_mechanism, R.mipmap.ntingency_plan, R.mipmap.emergency_rehearsal, R.mipmap.security_check, R.mipmap.emergency_statistics, R.mipmap.assess_pool, R.mipmap.assess_pool};
//    private static final int[] img1YW = new int[]{R.mipmap.security_check};
//    // private static final int[] img2 = new int[]{R.mipmap.organization, R.mipmap.safety_education, R.mipmap.accident_treatment, R.mipmap.accident_treatment, R.mipmap.chance_inspect, R.mipmap.periodic_inspection, R.mipmap.ectocy_administration};
//    private static final int[] img2YW = new int[]{R.mipmap.organization, R.mipmap.safety_education, R.mipmap.security_check};//
//    //    private static final int[] img3 = new int[]{R.mipmap.roster, R.mipmap.equipment_summary, R.mipmap.holiday_rota, R.mipmap.check_duty, R.mipmap.comprehensive_examination, R.mipmap.packs, R.mipmap.comprehensive_examination, R.mipmap.ntingency_plan, R.mipmap.emergency_statistics, R.mipmap.chance_inspect};
//    //private static final int[] img3 = new int[]{R.mipmap.roster, R.mipmap.equipment_summary, R.mipmap.holiday_rota, R.mipmap.check_duty, R.mipmap.comprehensive_examination, R.mipmap.packs};
//    private static final int[] img3YW = new int[]{R.mipmap.check_duty};
//
//    private static final int[] img4YW = new int[]{R.mipmap.comprehensive_examination};
//    private static final int[] img5YW = new int[]{R.mipmap.comprehensive_examination};

    private int type = 0;

    @NonNull
    @Override
    protected String initTitleName() {
        return "安保管理";
    }

    @NonNull
    @Override
    protected List<HomeDataBean> initAdapterData() {
        return null;
    }
//        return HomeDataHelper.getInstance().getHomeDataYW(
//                stringsTop,
//                stringsSub1,
//                stringsSub2,
//                stringsSub3,
//                stringsSub4,
//                stringsSub5YW, img1, img2, img3, img4, img5YW);
//    }

    @Override
    public void setListener() {
        super.setListener();

        mAdapterYW = new MyHomeAdapter(SecurityManagerHomeActivity.this);
        recyclerViewYW.setAdapter(mAdapterYW);
//        mAdapterYW.setData(HomeDataHelper.getInstance().getHomeDataYW(stringsTopYW, stringsSub1YW, stringsSub2YW, stringsSub3YW, stringsSub4YW, stringsSub5YW, img1YW, img2YW, img3YW, img4YW, img5YW));


        llZHYW.setVisibility(View.VISIBLE);
        tvHZ.setVisibility(View.VISIBLE);
        tvZH.setBackground(getResources().getDrawable(R.drawable.shape_rect_red));

        tvZH.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                tvZH.setBackground(getResources().getDrawable(R.drawable.shape_rect_red));
                tvYW.setBackground(getResources().getDrawable(R.drawable.shape_bg_stroke_r0));
                tvHZ.setVisibility(View.VISIBLE);

                type = 0;
                recyclerView.setVisibility(View.VISIBLE);
                recyclerViewYW.setVisibility(View.GONE);
//                mAdapter = new MyHomeAdapter(SecurityManagerHomeActivity.this);
//                recyclerView.setAdapter(mAdapter);
//                mAdapter.setData(HomeDataHelper.getInstance().getHomeData(stringsTop, stringsSub1, stringsSub2, stringsSub3, img1, img2, img3));

            }
        });

        tvYW.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                type = 1;
                recyclerView.setVisibility(View.GONE);
                recyclerViewYW.setVisibility(View.VISIBLE);
                tvZH.setBackground(getResources().getDrawable(R.drawable.shape_bg_stroke_r0));
                tvYW.setBackground(getResources().getDrawable(R.drawable.shape_rect_red));
                tvHZ.setVisibility(View.GONE);

            }
        });


        tvHZ.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(EmergencySaveCollectionActivity.class);//安全管理考核汇总
            }
        });


        mAdapter.setItemClickListener(new MyHomeAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(int parentPosition, int childPosition) {
                if (parentPosition == 0) {
                    if (childPosition == 0) {
                        //startActivity(ExaminationAllActivity.class);//应急保障基地
                        startActivity(EmergencyEnsure1Activity.class);//应急保障基地
                    } else if (childPosition == 1) {
                        //startActivity(ExaminationAllActivity.class);//应急机制
                        //startActivity(Emergency1Activity.class);//应急机制
                        startActivity(EmergencyEnsureMadeActivity.class);//应急保障机制
                    } else if (childPosition == 2) {
                        // startActivity(ExaminationAllActivity.class);//应急预案体系
                        startActivity(EmergencyPlan1Activity.class);//应急预案体系
                    } else if (childPosition == 3) {
                        // startActivity(TrafficAllActivity.class);//应急演练
                        startActivity(EmergencyDrill1Activity.class);//应急演练
                    }
//                    else if (childPosition == 4) {
//                        //startActivity(SummaryOfChargesActivity.class);//应急检查
//                        startActivity(EmergencyCheck1Activity.class);//应急检查
//                    }
                    else if (childPosition == 4) {
                        //startActivity(OtherBusinessSearchActivity.class);//应急事件统计
                        startActivity(EmergencyEvent1Activity.class);//应急事件统计
                    }

//                    else if (childPosition == 6){
//                        startActivity(EmergencySaveCollectionActivity.class);//安全管理考核汇总
//                    }else{
//                        startActivity(EmergencyEnsureMadeActivity.class);//应急保障机制
//                    }
                } else if (parentPosition == 1) {
                    if (childPosition == 0) {
                        // startActivity(JobEvaluationActivity.class);//安全生产组织机构
                        startActivity(EmergencySaveAgency1Activity.class);//安全生产组织机构
                    } else if (childPosition == 1) {
                        //startActivity(MyEvaluationActivity.class);//安全教育
                        startActivity(EmergencySaveEdu1Activity.class);//安全教育
                    }
//
//                    else if (childPosition == 2) {
//                        //startActivity(TrafficChargeActivity.class);//安全事故处理
//                        startActivity(EmergencySaveThingsDeal1Activity.class);//安全事故处理
//                    }
//                    else if (childPosition == 3) {
//                        //startActivity(TrafficChargeActivity.class);//安全检查
//                        startActivity(EmergencySaveCheckLeader1Activity.class);//安全检查
//                    }
                    else if (childPosition == 2) {
                        // startActivity(TrafficChargeActivity.class);//作业区专项检查
                        startActivity(EmergencyCuring1Activity.class);//作业区专项检查
                    }
//                    else if (childPosition == 5) {
//                        startActivity(TrafficChargeActivity.class);//定期检查
//                    }
                    else if (childPosition == 3) {
                        //startActivity(TrafficChargeActivity.class);//外包工程安全管理
                        startActivity(EmergencyOutSaveManager1Activity.class);//外包工程安全管理
                    } else if (childPosition == 4) {
                        //startActivity(TrafficChargeActivity.class);//安全检查
                        startActivity(EmergencySaveCheckLeader1Activity.class);//安全检查

                    }
                } else if (parentPosition == 2) {
                    if (childPosition == 0) {
                        //护队花名册
                        startActivity(EmergencyProtectActivity.class);
                    } else if (childPosition == 1) {
                        //防爆器材汇总
                        //startActivity(EmergencyAvoidExplode1Activity.class);
                        startActivity(AvoidActivity.class);
                    } else if (childPosition == 2) {
                        // startActivity(ExaminationAllActivity.class);//节日值班表
                        startActivity(EmergencyFestivalDutyActivity.class);//节日值班表
                    } else if (childPosition == 3) {
                        // startActivity(TrafficAllActivity.class);//值带班检查
                        startActivity(EmergencyProtectCollectionActivity.class);//值带班检查
                    }
//                    else if (childPosition == 4) {
//                        startActivity(SummaryOfChargesActivity.class);//综治维稳定期检查
//                    }
//                    else if (childPosition == 4) {
//                        //startActivity(OtherBusinessSearchActivity.class);//包联包户
//                        startActivity(EmergencyProtectListActivity.class);//包联包户
//                    }
//                    else if (childPosition == 6) {
//                        startActivity(EmergencyAvoidExplode1Activity.class);//防爆汇总1
//                    } else if (childPosition == 7) {
//                        startActivity(EmergencyAvoidExplode2Activity.class);//防爆汇总2
//                    } else if (childPosition == 8) {
//                        startActivity(EmergencyPackageLeaderSeeActivity.class);//包联领导
//                    } else if (childPosition == 9) {
//                        //startActivity(EmergencyPackageEdit1Activity.class);//包联编辑1
//                    }
                } else if (parentPosition == 3) {
                    if (childPosition == 0) {
                        startActivity(EmergencyProtectListActivity.class);//包联包户
                    }
                }
            }
        });

        mAdapterYW.setItemClickListener(new MyHomeAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(int parentPosition, int childPosition) {
                if (parentPosition == 0) {
                    if (childPosition == 0) {
                        startActivity(EmergencyCheck1Activity.class);//
                    }

                } else if (parentPosition == 1) {
                    if (childPosition == 0) {
                        startActivity(EmergencyCuring1Activity.class);//作业区专项检查
                    } else if (childPosition == 1) {
                        startActivity(EmergencySaveCheckLeader1Activity.class);//安全检查
                    } else if (childPosition == 2) {
                        startActivity(EmergencySaveZG1Activity.class);//安全整改
                    } else if (childPosition == 3) {
                        startActivity(EmergencySaveZG1Activity.class);//安全整改
                    }
                } else if (parentPosition == 2) {
                    if (childPosition == 0) {
                        startActivity(EmergencyProtectCollectionActivity.class);//值带班检查
                    }

                } else if (parentPosition == 3) {
                    if (childPosition == 0) {
                        startActivity(EmergencyProtectListActivity.class);//包联包户
                    }
                }
            }
        });
    }
}